# 用类封装一个Math类，实现加、减、乘、除、幂、开方
class MyMath:
    def add(self, x, y):
        return x + y

    def min(self, x, y):
        return x - y

    def mul(self, x, y):
        return x * y

    def div(self, x, y):
        return x / y

    def pow(self, x, y):
        return x ** y

    def root(self, x, y):
        return x ** (1/y)


calculator = MyMath()
print(MyMath().add(2, 3))
print(calculator.min(2, 3))
print(calculator.mul(2, 3))
print(calculator.div(2, 3))
print(MyMath().pow(2, 3))
print(MyMath().root(2, 3))


print('----------分隔线----------')

# 自由课题，按照自己的想法将身边的事物抽象成类，并创建多个实例


class Phone(object):
    price = 5000

    def powon(self):
        pass

    def powoff(self):
        pass


class Android(Phone):
    def powon(self):
        pass

    # 实例初始化

    def __init__(self, nation):
        self.nation = nation

    syste = "ANDR"
    brand = '小米'
    color = "black"


class Iphone(Phone):
    syste = "IOS"
    brand = '苹果'
    color = 'white'


# 实例化
xiaomi = Android("中国")

print(Android.brand, f"{xiaomi.nation}品牌手机")

print('----------分隔线----------')

print("售价5000的苹果：", Iphone.price)
print("售价5000的Android：", Android.price)
print("将打印Iphone的品牌：", Iphone.brand)
print("将打印Android的一个品牌：", Android.brand)